﻿@model BLL.Model.Apply.ApplyInfo
@{
    Layout = null;
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    $().ready(function () {
        $(".input-validation-error").hide();
        $(":button").button();
        $("#btnPass").click(function () {
            if (checkApprovalComment()) {
                submit("/apply/ApprovalPass/");
            }
            return false;
        });
        $("#btnRefuse").click(function () {
            if (checkApprovalComment()) {
                submit("/apply/ApprovalRefuse/");
            }
            return false;
        });
    });

    function submit(url) {
        $.post(url, getData(), function (result) {
            if (result != "error") {
                alert("审批成功！");
                $("#editDiv").data("dialog").close();
            }
            else {
                alert(result);
            }
        });
    }

    function checkApprovalComment() {
        var s = $("#ApprovalComment").val();
        if ($.trim(s) != "") {
            return true;
        }
        $(".input-validation-error").show();
        return false;
    }

    function getData() {
        return $("form").serialize();
    }
</script>
<fieldset>
    <legend>申请详情（当前状态：@ViewBag.Status）</legend>
    @Html.ValidationSummary(true)
    <div class="ez-wr" style="text-align: left; margin-top: 10px;">
        <div class="ez-box" style="">
            <div class="ez-wr">
                <div class="ez-fl ez-negmr ez-15" style="">
                    <div class="ez-box">
                        @Html.LabelFor(model => model.Title)：
                    </div>
                </div>
                <div class="ez-last ez-oh">
                    <div class="ez-box">
                        @Html.DisplayFor(model => model.Title)
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="ez-wr" style="text-align: left; margin-top: 10px;">
        <div class="ez-box" style="">
            <div class="ez-wr">
                <div class="ez-fl ez-negmr ez-15">
                    <div class="ez-box">
                        @Html.LabelFor(model => model.ApplyUser)：
                    </div>
                </div>
            <div class="ez-fl ez-negmr ez-15">
                <div class="ez-box">
                    @Html.DisplayFor(model => model.ApplyUser.UserName)
                </div>
            </div>
            <div class="ez-fl ez-negmr ez-10" style="">
                <div class="ez-box">
                    @Html.LabelFor(model => model.ApplyDate)：
                </div>
            </div>
            <div class="ez-last ez-oh">
                <div class="ez-box">
                    @Html.DisplayFor(model => model.ApplyDate)
                </div>
            </div>
        </div>
    </div>
    </div>
    <div class="ez-wr" style="text-align: left; margin-top: 10px;">
        <div class="ez-box" style="">
            <div class="ez-wr">
                <div class="ez-fl ez-negmr ez-15" style="">
                    <div class="ez-box">
                        @Html.LabelFor(model => model.MemroySize)：
                    </div>
                </div>
                <div class="ez-last ez-oh">
                    <div class="ez-box">
                        @Html.DisplayFor(model => model.MemroySize)
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="ez-wr" style="text-align: left; margin-top: 10px;">
        <div class="ez-box" style="">
            <div class="ez-wr">
                <div class="ez-fl ez-negmr ez-15" style="">
                    <div class="ez-box">
                        @Html.LabelFor(model => model.DiskSize)：
                    </div>
                </div>
                <div class="ez-last ez-oh">
                    <div class="ez-box">
                        @Html.DisplayFor(model => model.DiskSize)
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="ez-wr" style="text-align: left; margin-top: 10px;">
        <div class="ez-box" style="">
            <div class="ez-wr">
                <div class="ez-fl ez-negmr ez-15" style="">
                    <div class="ez-box">
                        @Html.LabelFor(model => model.CPUCore)：
                    </div>
                </div>
                <div class="ez-last ez-oh">
                    <div class="ez-box">
                        @Html.DisplayFor(model => model.CPUCore)
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="ez-wr" style="text-align: left; margin-top: 10px;">
        <div class="ez-box" style="">
            <div class="ez-wr">
                <div class="ez-fl ez-negmr ez-15" style="">
                    <div class="ez-box">
                        操作系统:
                    </div>
                </div>
                <div class="ez-last ez-oh">
                    <div class="ez-box">
                        @Html.DisplayFor(model => model.OperatingSystemType.Name)
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="ez-wr" style="text-align: left; margin-top: 10px;">
        <div class="ez-box" style="">
            <div class="ez-wr">
                <div class="ez-fl ez-negmr ez-15" style="">
                    <div class="ez-box">
                        @Html.LabelFor(model => model.Comment)：
                    </div>
                </div>
                <div class="ez-last ez-oh">
                    <div class="ez-box">
                        @Html.DisplayFor(model => model.Comment)
                    </div>
                </div>
            </div>
        </div>
    </div>
    @using (Html.BeginForm())
    {
        <div class="ez-wr" style="text-align: left; margin-top: 10px;" id="divApproval">
            <div class="ez-box" style="">
                <div class="ez-wr">
                    <div class="ez-fl ez-negmr ez-15" style="">
                        <div class="ez-box">
                            审批意见：
                        </div>
                    </div>
                    <div class="ez-last ez-oh">
                        <div class="ez-box">
                            @Html.HiddenFor(model => model.Id)
                            @Html.TextArea("ApprovalComment", "", 5, 10, new { @style = "width:70%" })
                            <em>告知申请人的注意事项</em>
                        </div>
                    </div>
                    <div class="ez-box input-validation-error">
                        请填写审批意见
                    </div>
                </div>
            </div>
        </div>
    }
    <p>
        <input type="button" value="审批通过" id="btnPass" />&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" value="审批未通过" id="btnRefuse" />
    </p>
</fieldset>
